php forum
php mysql forum
php mysql smarty
 
Topic Options
#318684 - 02/16/11 09:42 PM [7.x] Stop Forum Spam Integration v0.2 (Template)
Gizmo Offline

Wizard

Registered: 01/10/00
Posts: 5354
Loc: Portland, OR, USA
This Template Hack is no longer supported, instead please see the Stop Forum spam Integration (Modification) thread.

Author: Gizmo (James of VNC Web Design)

Requirements:
  • Valid UBB.Threads 7.0 install and license
  • PHP5+, PHP4 is not supported.
  • To REPORT users you will need an API Key from Stop Forum Spam.


About:
This modification will allow you to check your users (via the "Edit User" function in the Control Panel) and new signups (via the "Registration Queue") against the Stop Forum Spam databases.

When a spammer is identified a Red/Bold ! will display next to the field, clicking this ! will allow you to view the associated data on Stop Forum Spam.

Demo:
See the screen captures attached to this thread for a demo.

The Modification
In templates/default/admin/membermanage.tmpl
Find:
Code:
for($i=0;$i<sizeof($que);$i++) { //UBBTREMARK


Add Under:
Code:
	$xml_string = file_get_contents("http://www.stopforumspam.com/api?email=". $que[$i]['email']);
	$xml = new SimpleXMLElement($xml_string);
	if($xml->appears == 'yes'){
		$spammer_real_email = " <a href=\"http://stopforumspam.com/search/?q=". $que[$i]['email'] ."\" target=\"_blank\" style=\"color: #FF0000; font-weight: bold;\">!</a>";
	} else {
		$spammer_real_email = "";
	}

	$xml_string = file_get_contents("http://www.stopforumspam.com/api?ip=". $que[$i]['ip']);
	$xml = new SimpleXMLElement($xml_string);
	if($xml->appears == 'yes'){
		$spammer_reg_ip = " <a href=\"http://stopforumspam.com/ipcheck/". $que[$i]['ip'] ."\" target=\"_blank\" style=\"color: #FF0000; font-weight: bold;\">!</a>";
	} else {
		$spammer_reg_ip = "";
	}



Find:
Code:
<br />{$que[$i]['uname']}<br />{$que[$i]['email']}<br />{$que[$i]['ip']}


Replace With:
Code:
<br />{$que[$i]['uname']}<br />{$que[$i]['email']}{$spammer_real_email}<br />{$que[$i]['ip']}{$spammer_reg_ip}



In templates/default/admin/showuser.tmpl
Find:
Code:
$forum_link = make_ubb_url("", "", false);



Add Under:
Code:
	$xml_string = file_get_contents("http://www.stopforumspam.com/api?email=". $email);
	$xml = new SimpleXMLElement($xml_string);
	if($xml->appears == 'yes'){
		$spammer_real_email = " <a href=\"http://stopforumspam.com/search/?q=". $email ."\" target=\"_blank\" style=\"color: #FF0000; font-weight: bold;\">!</a>";
	} else {
		$spammer_real_email = "";
	}

	$xml_string = file_get_contents("http://www.stopforumspam.com/api?ip=". $regip);
	$xml = new SimpleXMLElement($xml_string);
	if($xml->appears == 'yes'){
		$spammer_reg_ip = " <a href=\"http://stopforumspam.com/ipcheck/". $regip ."\" target=\"_blank\" style=\"color: #FF0000; font-weight: bold;\">!</a>";
	} else {
		$spammer_reg_ip = "";
	}

	if($lastpostip != "") {
		$xml_string = file_get_contents("http://www.stopforumspam.com/api?ip=". $lastpostip);
		$xml = new SimpleXMLElement($xml_string);
		if($xml->appears == 'yes'){
			$spammer_last_ip = " <a href=\"http://stopforumspam.com/ipcheck/". $lastpostip ."\" target=\"_blank\" style=\"color: #FF0000; font-weight: bold;\">!</a>";
		} else {
			$spammer_last_ip = "";
		}
	} else {
		$spammer_last_ip = "";
	}


Find:
Code:
<input type="text" name="email" value="$email" id="email" />


Replace With:
Code:
<input type="text" name="email" value="$email" id="email" />$spammer_real_email


Find:
Code:
$regdate - $regip


Replace With:
Code:
$regdate - $regip$spammer_reg_ip


Find:
Code:
$lastpost - $lastpostip


Replace With:
Code:
$lastpost - $lastpostip$spammer_last_ip



To be able to report users
In templates/default/admin/showuser.tmpl
Find:
Code:
$forum_link = make_ubb_url("", "", false);



Add Under (be sure to add your API Key to the API-Key section below):
Code:
	if($lastpostip != "") {
		$report_spammer = "http://www.stopforumspam.com/add.php?username=". $lname ."&ip_addr=". $lastpostip ."&email=". $email ."&api_key=API-KEY";
	} else {
		$report_spammer = "http://www.stopforumspam.com/add.php?username=". $lname ."&ip_addr=". $regip ."&email=". $email ."&api_key=API-KEY";
	}


Find:
Code:
$lname


Replace With:
Code:
$lname (<a href="$report_spammer" target="_blank" style="color: #FF0000;">Report Spammer</a>)




To detect and deny detected spammers when they register (via IP):
In templates/default/newuser_signup.tpl
Find:
Code:
{* Script Version 7.5.6 *}


Add Under:
Code:
{php}
	$xml_string = file_get_contents("http://www.stopforumspam.com/api?ip=". $_SERVER["REMOTE_ADDR"]);
	$xml = new SimpleXMLElement($xml_string);

	if ($xml->appears == 'yes') {
{/php}
{$tbopen}
<tr>
<td class="tdheader" colspan="2">
Spammer Detected
</td>
</tr>
<tr>
<td colspan="2" class="alt-2">
At this time your registration can not be continued.  Your IP address has been flagged as that of a known spammer/spambot via the <a href="http://stopforumspam.com/ipcheck/{$smarty.server.REMOTE_ADDR}" target="_blank">Stop Forum Spam</a> database.  To proceed you'll need to <a href="http://stopforumspam.com/contact" target="_blank">contact them</a> to clear yourself from their database.
</td>
</tr>
{$tbclose}

{php}
	} else {
{/php}



Find:
Code:
</form>


Add Under:
Code:
{php} } {/php}




NOTE: StopForumSpam.com only allows 5k lookups per day; thus, you should refrain from attempting to implement this code on pages which would quickly hit this limit (such as adding searches for all types of data on the search users page).


Attachments
edituser.jpg (31 downloads)
regqueue.jpg (32 downloads)
reportspam.jpg (26 downloads)
detected.jpg (29 downloads)

_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design & Development President
UBB.Threads: My UBBSkins, UBB.Sitemaps

Top
#318685 - 02/16/11 11:06 PM Re: [7.x] Stop Forum Spam Integration v0.2 (Template) [Re: Gizmo]
SteveS Offline
Lurker

Registered: 03/27/07
Posts: 9
Thanks Gizmo! It appears to work very well.

Top
#318686 - 02/16/11 11:14 PM Re: [7.x] Stop Forum Spam Integration v0.2 (Template) [Re: Gizmo]
gliderdad79 Offline
User

Registered: 03/24/06
Posts: 31
Works great, thanks Giz :thumb:

Top
#318689 - 02/18/11 07:53 PM Re: [7.x] Stop Forum Spam Integration v0.2 (Template) [Re: Gizmo]
Gizmo Offline

Wizard

Registered: 01/10/00
Posts: 5354
Loc: Portland, OR, USA
Added ability to report spammers; see the last step and the notice about retrieving an API Key.
_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design & Development President
UBB.Threads: My UBBSkins, UBB.Sitemaps

Top
#318690 - 02/18/11 09:30 PM Re: [7.x] Stop Forum Spam Integration v0.2 (Template) [Re: Gizmo]
Larry920 Offline
Lurker

Registered: 11/14/10
Posts: 1

Thanks Gizmo. We are gonna try it over the weekend and see what happens. We do have an API. Will report back.

Larry

Top
#318691 - 02/18/11 10:24 PM Re: [7.x] Stop Forum Spam Integration v0.2 (Template) [Re: Gizmo]
gliderdad79 Offline
User

Registered: 03/24/06
Posts: 31
Thanks Giz, I just signed up there and tested with the API and it submitted perfectly. Good job :thumb:

Top
#318692 - 02/18/11 11:11 PM Re: [7.x] Stop Forum Spam Integration v0.2 (Template) [Re: Gizmo]
Gizmo Offline

Wizard

Registered: 01/10/00
Posts: 5354
Loc: Portland, OR, USA
Yeah, I grossly over-analyzed how to do it; when I thought outside the box with the demo code I had it just sort of clicked how easy it really was...

The "hard" part was where to put the report link yet have it stand out, so I just kind of suggested its current placement.

I also over-thought what to submit, then I figured that the only thing that really matters was their latest ip, so if a "last post ip" didn't exist then just grab the reg ip so no matter what it'd be their "last logged" ip address.

Have a couple little things I want to work in, but I went and reported this mod to them so that they could (hopefully) add it to their listing.

Let me know if you guys run into any oddities and I'll take a look. I'm thinking about building a separate (non UBB) script to do a one-time scan of user data, meant to be run on different days for large forums (to bypass the 5k limit) but I'll have that separate for those who want it.
_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design & Development President
UBB.Threads: My UBBSkins, UBB.Sitemaps

Top
#318693 - 02/18/11 11:34 PM Re: [7.x] Stop Forum Spam Integration v0.2 (Template) [Re: Gizmo]
gliderdad79 Offline
User

Registered: 03/24/06
Posts: 31
Thanks Giz, I would def love to see this become stock in v8!!

Top
#318694 - 02/19/11 12:01 AM Re: [7.x] Stop Forum Spam Integration v0.2 (Template) [Re: gliderdad79]
Gizmo Offline

Wizard

Registered: 01/10/00
Posts: 5354
Loc: Portland, OR, USA
Originally Posted By: gliderdad79
Thanks Giz, I would def love to see this become stock in v8!!
Well, my code is pretty basic, Rick is more than welcome to use it for inspiration for v8; it's torn from the demo's at stopforumspam's api documentation.

In its current phase it's perfect for anyone who wants to use it, it likely won't hit their 5k limit; the problem is the api key needed for submission; but it could just not show unless an api key shows in the config.

It'd be great to integrate with the reg process, but the idea of false positives that users need to contact stopforumspam.com to bypass is kind of a setback... If I do add it (and I probably will) I'd advise against its general use, but it'd be there regardless.
_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design & Development President
UBB.Threads: My UBBSkins, UBB.Sitemaps

Top
#318695 - 02/19/11 12:05 AM Re: [7.x] Stop Forum Spam Integration v0.2 (Template) [Re: Gizmo]
gliderdad79 Offline
User

Registered: 03/24/06
Posts: 31
If included in stock I think it would need to be an option like twitter where you need to check the box to enable and enter your twitter name or in this case api key.


Edited by gliderdad79 (02/19/11 12:05 AM)

Top
#318696 - 02/19/11 02:39 AM Re: [7.x] Stop Forum Spam Integration v0.2 (Template) [Re: Gizmo]
Gizmo Offline

Wizard

Registered: 01/10/00
Posts: 5354
Loc: Portland, OR, USA
Basically, yeah, that's what I was going for
_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design & Development President
UBB.Threads: My UBBSkins, UBB.Sitemaps

Top
#318697 - 02/19/11 02:54 AM Re: [7.x] Stop Forum Spam Integration v0.2 (Template) [Re: Gizmo]
gliderdad79 Offline
User

Registered: 03/24/06
Posts: 31
Great minds think.... Who am I kidding I dont have a great mind :roflmao:

Top
#318698 - 02/20/11 01:07 AM Re: [7.x] Stop Forum Spam Integration v0.2 (Template) [Re: Gizmo]
Gizmo Offline

Wizard

Registered: 01/10/00
Posts: 5354
Loc: Portland, OR, USA
Added the ability to do an IP check against the Stop Forum Spam database at signup; if their IP is detected then they're not allowed to sign up (see the screen attached for the error message portion).
_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design & Development President
UBB.Threads: My UBBSkins, UBB.Sitemaps

Top
#318699 - 02/21/11 08:35 PM Re: [7.x] Stop Forum Spam Integration v0.2 (Template) [Re: Gizmo]
gliderdad79 Offline
User

Registered: 03/24/06
Posts: 31
Sweet, been added. I see no reason this shouldn't be added to stock, I hope it does!

Top
#318701 - 03/07/11 06:16 AM Re: [7.x] Stop Forum Spam Integration v0.2 (Template) [Re: Gizmo]
Crasher Offline
Newbie

Registered: 10/18/07
Posts: 10
Awesome

Works a treat smile

Cheers for this.

Regards

Barry
_________________________
I don't do a lot, but i do do this

Top
#318730 - 03/25/11 08:14 PM Re: [7.x] Stop Forum Spam Integration v0.2 (Template) [Re: Gizmo]
Gizmo Offline

Wizard

Registered: 01/10/00
Posts: 5354
Loc: Portland, OR, USA
Fixed a bug reported by Gliderdad with the showuser.tmpl portion for last post ip; when a user doesn't have a last post ip (0 posts) the script will throw an error; the fix is to just not do the check in this case. New code (updated on first post) is:

Take this:
Code:
	$xml_string = file_get_contents("http://www.stopforumspam.com/api?ip=". $lastpostip);
	$xml = new SimpleXMLElement($xml_string);
	if($xml->appears == 'yes'){
		$spammer_last_ip = " <a href=\"http://stopforumspam.com/ipcheck/". $lastpostip ."\" target=\"_blank\" style=\"color: #FF0000; font-weight: bold;\">!</a>";
	} else {
		$spammer_last_ip = "";
	}


Change To:
Code:
	if($lastpostip != "") {
		$xml_string = file_get_contents("http://www.stopforumspam.com/api?ip=". $lastpostip);
		$xml = new SimpleXMLElement($xml_string);
		if($xml->appears == 'yes'){
			$spammer_last_ip = " <a href=\"http://stopforumspam.com/ipcheck/". $lastpostip ."\" target=\"_blank\" style=\"color: #FF0000; font-weight: bold;\">!</a>";
		} else {
			$spammer_last_ip = "";
		}
	} else {
		$spammer_last_ip = "";
	}
_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design & Development President
UBB.Threads: My UBBSkins, UBB.Sitemaps

Top
#318737 - 04/09/11 04:37 PM Re: [7.x] Stop Forum Spam Integration v0.2 (Template) [Re: Gizmo]
Gizmo Offline

Wizard

Registered: 01/10/00
Posts: 5354
Loc: Portland, OR, USA
I've redone this template hack as a full modification available here. I've also added to it by setting it to check emails on registration and report offenders who're signing up with triggered email data to Stop Forum Spam automatically in the v0.3 Modification thread.
_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design & Development President
UBB.Threads: My UBBSkins, UBB.Sitemaps

Top



Moderator:  sirdude 
Latest Posts
[7.2.1] - Naked shoutbox
by bellaonline
05/05/12 05:00 PM
[7.x] Stop Forum Spam Integration v0.4
by bellaonline
05/05/12 03:53 PM
Shout Box

(Views)Popular Topics
Known public proxy servers 1689885
Integrated Index Page (IIP) 5.3.1 555705
Finished-[6.5.2] Games Arcade Deluxe v1.9 501236
Integrated Index Page (IIP) 5.1.1 415112
TLD Bv2.1 Released - Threads Links Directory 396822
[6.0x] Who's Online 4.0.0 [Finished] 389412
Finished-[6.5.1] Integrated Index Page (IIP) 6.5 330423
Q & A 298663
Slash UBB 266936
[6.3.x] [beta] Hit Hack 2.0 227970
Forum Stats
13621 Members
59 Forums
37191 Topics
295716 Posts

Max Online: 686 @ 06/28/07 07:04 AM

 

 

 
fusionbb message board php hacks